package com.study.zouchao.superproject.qustionadd.model;
import com.study.zouchao.superproject.base_zou.api_zou.Api_C;
import com.study.zouchao.superproject.qustionadd.contract.IQuestionAddContract;
import com.study.zouchao.superproject.qustionadd.model.result.questionadd.QuestionAddResult;
import com.study.zouchao.superproject.qustionadd.model.result.updateimg.QuestionUpdateImgResult;
import com.study.zouchao.superproject.util.RxSchedulers;
import com.study.zouchao.superproject.util.api.api.Api;

import java.util.Map;


import rx.Observable;

/**
 * 用户编写回答Model
 * Created by Administrator on 2017/4/25.
 */

public class QuestionAddModel implements IQuestionAddContract.IQuestionAddModel {

    @Override
    public Observable<QuestionUpdateImgResult> updateImg(Map<String, String> params) {
        return  Api.getInstance(Api_C.BASE_URL_LIN_BASE).mApiService
                .uploadImgByPOST(params)
                .compose(RxSchedulers.<QuestionUpdateImgResult>io_main());
    }

    @Override
    public Observable<QuestionAddResult> questionAdd(Map<String, String> params) {
        return  Api.getInstance(Api_C.BASE_URL_LIN_BASE).mApiService
                .addQuestionByPOST(params)
                .map(RxSchedulers.<QuestionAddResult>sleep(1200))
                .compose(RxSchedulers.<QuestionAddResult>io_main());
    }
}
